/**
 * 
 */
package ua.lviv.franko.mlsFunctions.threeDimension.weightFunctions;

import ua.lviv.franko.mlsFunctions.oneDimension.weightFunctions.IWeightFunction;

/**
 * @author marko
 * 
 */
public class CubeSupport implements IWeightFunction3D {

	protected IWeightFunction	func;

	public CubeSupport(IWeightFunction func) {
		this.func = func;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * mlsFunctions.threeDimension.weightFunctions.IWeightFunction3D#calculate
	 * (double, double, double, double, double, double, double)
	 */
	@Override
	public double calculate(double x, double y, double z, double xi, double yi, double zi, double rho) {
		return func.calculate(x, xi, rho) * func.calculate(y, yi, rho) * func.calculate(z, zi, rho);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see mlsFunctions.threeDimension.weightFunctions.IWeightFunction3D#
	 * calculateDerivatyX(double, double, double, double, double, double,
	 * double)
	 */
	@Override
	public double calculateDerivatyX(double x, double y, double z, double xi, double yi, double zi, double rho) {
		return func.calculateDerivaty(x, xi, rho) * func.calculate(y, yi, rho) * func.calculate(z, zi, rho);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see mlsFunctions.threeDimension.weightFunctions.IWeightFunction3D#
	 * calculateDerivatyY(double, double, double, double, double, double,
	 * double)
	 */
	@Override
	public double calculateDerivatyY(double x, double y, double z, double xi, double yi, double zi, double rho) {
		return func.calculate(x, xi, rho) * func.calculateDerivaty(y, yi, rho) * func.calculate(z, zi, rho);
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see mlsFunctions.threeDimension.weightFunctions.IWeightFunction3D#
	 * calculateDerivatyZ(double, double, double, double, double, double,
	 * double)
	 */
	@Override
	public double calculateDerivatyZ(double x, double y, double z, double xi, double yi, double zi, double rho) {
		return func.calculate(x, xi, rho) * func.calculate(y, yi, rho) * func.calculateDerivaty(z, zi, rho);
	}

}
